/**
 * Copyright (C) 2013-2014 the original author or authors.
 */
package com.foreveross.bsl.common.utils.ws.jaxrs;

import javax.ws.rs.ext.ParamConverter;

import com.foreveross.bsl.common.utils.mapper.JsonMapper;
import com.foreveross.bsl.common.utils.web.QuerySpecs;


/**
 * xxx
 *
 * @author Wangyi
 * @version v1.0
 *
 * @date 2013-9-16
 *
 */
public class QuerySpecsParamConverter implements ParamConverter<QuerySpecs> {
	
	private static final JsonMapper jsonMapper=JsonMapper.nonEmptyMapper();

	/* (non-Javadoc)
	 * @see javax.ws.rs.ext.ParamConverter#fromString(java.lang.String)
	 */
	@Override
	public QuerySpecs fromString(String value) throws IllegalArgumentException {
		QuerySpecs sfs=jsonMapper.fromJson(value, QuerySpecs.class);
		return sfs;
	}

	/* (non-Javadoc)
	 * @see javax.ws.rs.ext.ParamConverter#toString(java.lang.Object)
	 */
	@Override
	public String toString(QuerySpecs value) throws IllegalArgumentException {
		return jsonMapper.toJson(value);
	}
	
}
